<template>
  <div class="full-box shadow-box padding-box">
    <OperateCollection></OperateCollection>
    <div class="table-wrapper">
      <BaseTable
        :columns="columns"
        :showSort="true"
        :tableData="tableData"
        :pages="{
          show: true,
          count: count,
        }"
        :operate="{
          show: true,
          width: 150,
        }"
        @pagination="pageChange"
      >
        <template #operate="{ current }">
          <el-button
            type="primary"
            size="mini"
            @click="linkToDetails(current.row)"
            >详情</el-button
          >
        </template>
      </BaseTable>
    </div>
  </div>
</template>

<script>
import BaseTable from "@/components/Common/BaseTable.vue";
import OperateCollection from "../WorkCollection/components/OperateCollection.vue";
import { getAuditList } from "@/api/Audit/Index";
import commonList from "@/mixins/commonList";
export default {
  mixins: [commonList],
  components: { OperateCollection, BaseTable },
  data() {
    return {
      queryParams: {
        cur_year: new Date().getFullYear(),
        is_audit: "",
        is_finish: "",
        project_name: "",
        pageNum: 1,
        pageSize: 20,
      },
      count: 0,
      columns: columns,
      tableData: [],
    };
  },
  methods: {
    pageChange(val) {
      this.queryParams.pageNum = val.pageNum;
      this.queryParams.pageSize = val.pageSize;
      this.initData();
    },
    initData() {
      getAuditList(this.queryParams).then((res) => {
        if (res.code == 0) {
          this.tableData = res.data;
          this.count = res.num;
        }
      });
    },
    linkToDetails(item) {
      this.$router.push(`/auditDetails/${item.id}/1`);
    },
  },
  created() {
    this.initData();
  },
};

const columns = [
  {
    prop: "project_name",
    label: "项目名称",
    width: "",
    minWidth: "300",
    align: "",
  },
  {
    prop: "owner_name",
    label: "建设单位",
    width: "",
    minWidth: "200",
    align: "",
  },
  {
    prop: "investment",
    label: "投资额（万元）",
    width: "150",
    minWidth: "",
    align: "",
  },
];
</script>

<style lang="scss" scoped>
</style>